package day03;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Demo06 {
    public static void main(String[] args) throws Exception {
        Connection connection = JDBCUtils.getConnection();
        String sql = "insert into category (cname) values (?)";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        for (int i = 100; i < 200; i++) {
            preparedStatement.setObject(1, "java" + i);
            preparedStatement.addBatch();
        }
        preparedStatement.executeBatch();
        JDBCUtils.close(connection, preparedStatement, null);
    }
}
